package com.wjc.common

import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.BitmapFactory

/**
 * ClassName: com.wjc.common
 * Description:处理本地bitmap 或 drawable
 * JcChen on 2021.09.26.07:57
 */

fun getBitmapWithRes(res: Resources, resId: Int, height: Int): Bitmap {
    val options = BitmapFactory.Options();
    options.inJustDecodeBounds = true
    BitmapFactory.decodeResource(res, resId, options)
    options.inJustDecodeBounds = false
    options.inDensity = options.outWidth
    options.inTargetDensity = height
    return BitmapFactory.decodeResource(res, resId, options)
}